<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="lib.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python documentation Index' />
<link rel="first" href="lib.html" title='Python library Reference' />
<link rel='contents' href='contents.html' title="Contents" />
<link rel='index' href='genindex.html' title='Index' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="prev" href="misc.html" />
<link rel="parent" href="misc.html" />
<link rel="next" href="formatter-interface.html" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name='aesop' content='information' />
<title>33.1 formatter -- Generic output formatting</title>
</head>
<body>
<div class="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="33. miscellaneous Services"
  href="misc.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="33. miscellaneous Services"
  href="misc.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="33.1.1 the Formatter Interface"
  href="formatter-interface.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="misc.html">33. Miscellaneous Services</a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="misc.html">33. Miscellaneous Services</a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="formatter-interface.html">33.1.1 The Formatter Interface</a>
</div>
<hr /></div>
</div>
<!--End of Navigation Panel-->

<h1><a name="SECTION0035100000000000000000">
33.1 <tt class="module">formatter</tt> --
         Generic output formatting</a>
</h1>

<p>
<a name="module-formatter"></a>

<p>
This module supports two interface definitions, each with multiple
implementations.  The <em>formatter</em> interface is used by the
<tt class="class">HTMLParser</tt> class of the <tt class="module"><a href="module-htmllib.html">htmllib</a></tt> module, and the
<em>writer</em> interface is required by the formatter interface.
<a id='l2h-5511' xml:id='l2h-5511'></a>
<p>
Formatter objects transform an abstract flow of formatting events into
specific output events on writer objects.  Formatters manage several
stack structures to allow various properties of a writer object to be
changed and restored; writers need not be able to handle relative
changes nor any sort of ``change back'' operation.  Specific writer
properties which may be controlled via formatter objects are
horizontal alignment, font, and left margin indentations.  A mechanism
is provided which supports providing arbitrary, non-exclusive style
settings to a writer as well.  Additional interfaces facilitate
formatting events which are not reversible, such as paragraph
separation.

<p>
Writer objects encapsulate device interfaces.  Abstract devices, such
as file formats, are supported as well as physical devices.  The
provided implementations all work with abstract devices.  The
interface makes available mechanisms for setting the properties which
formatter objects manage and inserting data into the output.

<p>

<p><br /></p><hr class='online-navigation' />
<div class='online-navigation'>
<!--Table of Child-Links-->
<a name="CHILD_LINKS"><strong>Subsections</strong></a>

<ul class="ChildLinks">
<li><a href="formatter-interface.html">33.1.1 The Formatter Interface</a>
<li><a href="formatter-impls.html">33.1.2 Formatter Implementations</a>
<li><a href="writer-interface.html">33.1.3 The Writer Interface</a>
<li><a href="writer-impls.html">33.1.4 Writer Implementations</a>
</ul>
<!--End of Table of Child-Links-->
</div>

<div class="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="33. miscellaneous Services"
  href="misc.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="33. miscellaneous Services"
  href="misc.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="33.1.1 the Formatter Interface"
  href="formatter-interface.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="misc.html">33. Miscellaneous Services</a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="misc.html">33. Miscellaneous Services</a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="formatter-interface.html">33.1.1 The Formatter Interface</a>
</div>
</div>
<hr />
<span class="release-info">Release 2.5.1, documentation updated on 18th April, 2007.</span>
</div>
<!--End of Navigation Panel-->
<address>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</address>
</body>
</html>
